package com.lcy.springtest;

import com.lcy.springtest.bean.Person;
import com.lcy.springtest.conf.SetPropertiesValueConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * @author lichenyang
 * @create 2021-04-19 3:48 下午
 */
public class SetPropertiesValueMainTest {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(SetPropertiesValueConfig.class);

        ConfigurableEnvironment environment = applicationContext.getEnvironment();
        String name = environment.getProperty("name");
        System.out.println("使用application获取: " + name);

        Person bean = applicationContext.getBean(Person.class);
        System.out.println(bean);
    }
}
